{"nbformat":4,"nbformat_minor":0,"metadata":{"colab":{"name":"transferLearningExp.ipynb","version":"0.3.2","provenance":[],"collapsed_sections":[]},"kernelspec":{"display_name":"Python 3","language":"python","name":"python3"},"accelerator":"GPU"},"cells":[{"metadata":{"id":"EbgOE_x7UjOB","colab_type":"text"},"cell_type":"markdown","source":["#Two-Stages Deep Learning Project\n","<p>This project has been developped by the Montreal Hacknight community.<p>\n","\n","<p><ul>https://github.com/robintibor/braindecode</ul>\n","<ul>https://github.com/NeuroTechX/moabb</ul></p>\n","\n","<p>This project wouldn't have been possible without the contribution of these people: Arna (...), Justin (...), Yannick Roy, Eamon Egan, (...) and it is currently being supported by Fred Simard (fs@re-ak.com)</p>\n","\n","<p>This project consist in deriving a two-stages training process from the brain decode implementation of a Shallow Convolutional Network. The core motivation is to combine the strenghts of deep learning - that is being one of the most powerful ML algorithms out-there - while grinding down it's fall back - it requires an immense of data.</p>\n","\n","<p>The goal is to develop a method to train the network in two stages:</p>\n","\n","<p><ul>1) Train the network over a large dataset, this training forms some kind of prior over the network (all but one subject)</ul>\n","<ul>2) Train the network a second time, on the dataset of interest (the subject left aside)</ul></p>\n","\n","<p>The premise motivating this approach is that the second training is likely to proceed faster than what is normally required to train a deep net, without sacrificing the performance, and will enable the possibility to train a deep learner on a smaller dataset; further, we suspect that the second training will be able to exploit the specificities of the dataset of interest in a way to surpasses the first training, which was trained on a generalistic dataset.</p>"]},{"metadata":{"id":"roVreEKZUjOC","colab_type":"code","outputId":"f4295a3d-4eb3-41dd-c117-99ed0cf15606","executionInfo":{"status":"ok","timestamp":1547773241689,"user_tz":300,"elapsed":214362,"user":{"displayName":"TheAtom2626","photoUrl":"","userId":"00378881698832173059"}},"colab":{"base_uri":"https://localhost:8080/","height":7650}},"cell_type":"code","source":["\n","\n","\"\"\"\n","#\n","# Download the dataset and segment per subject, \n","# NOTE: this block should be executed once and once only\n","#\n","\"\"\"\n","import os\n","if not os.path.exists(\"bnci-2014\"):\n","  os.mkdir(\"bnci-2014\")\n","\n","#if not os.path.exists(\"bnci-2014/S01E.mat\"):\n","if True:\n","  !wget http://bnci-horizon-2020.eu/database/data-sets/002-2014/S01E.mat -P \"bnci-2014\"\n","  !wget http://bnci-horizon-2020.eu/database/data-sets/002-2014/S01T.mat -P \"bnci-2014\"\n","  !wget http://bnci-horizon-2020.eu/database/data-sets/002-2014/S02T.mat -P \"bnci-2014\"\n","  !wget http://bnci-horizon-2020.eu/database/data-sets/002-2014/S02E.mat -P \"bnci-2014\"\n","  !wget http://bnci-horizon-2020.eu/database/data-sets/002-2014/S03T.mat -P \"bnci-2014\"\n","  !wget http://bnci-horizon-2020.eu/database/data-sets/002-2014/S03E.mat -P \"bnci-2014\"\n","  !wget http://bnci-horizon-2020.eu/database/data-sets/002-2014/S04T.mat -P \"bnci-2014\"\n","  !wget http://bnci-horizon-2020.eu/database/data-sets/002-2014/S04E.mat -P \"bnci-2014\"\n","  !wget http://bnci-horizon-2020.eu/database/data-sets/002-2014/S05T.mat -P \"bnci-2014\"\n","  !wget http://bnci-horizon-2020.eu/database/data-sets/002-2014/S05E.mat -P \"bnci-2014\"\n","  !wget http://bnci-horizon-2020.eu/database/data-sets/002-2014/S06T.mat -P \"bnci-2014\"\n","  !wget http://bnci-horizon-2020.eu/database/data-sets/002-2014/S06E.mat -P \"bnci-2014\"\n","  !wget http://bnci-horizon-2020.eu/database/data-sets/002-2014/S07T.mat -P \"bnci-2014\"\n","  !wget http://bnci-horizon-2020.eu/database/data-sets/002-2014/S07E.mat -P \"bnci-2014\"\n","  !wget http://bnci-horizon-2020.eu/database/data-sets/002-2014/S08T.mat -P \"bnci-2014\"\n","  !wget http://bnci-horizon-2020.eu/database/data-sets/002-2014/S08E.mat -P \"bnci-2014\"\n","  !wget http://bnci-horizon-2020.eu/database/data-sets/002-2014/S09T.mat -P \"bnci-2014\"\n","  !wget http://bnci-horizon-2020.eu/database/data-sets/002-2014/S09E.mat -P \"bnci-2014\"\n","  !wget http://bnci-horizon-2020.eu/database/data-sets/002-2014/S10T.mat -P \"bnci-2014\"\n","  !wget http://bnci-horizon-2020.eu/database/data-sets/002-2014/S10E.mat -P \"bnci-2014\"\n","  !wget http://bnci-horizon-2020.eu/database/data-sets/002-2014/S11T.mat -P \"bnci-2014\"\n","  !wget http://bnci-horizon-2020.eu/database/data-sets/002-2014/S11E.mat -P \"bnci-2014\"\n","  !wget http://bnci-horizon-2020.eu/database/data-sets/002-2014/S12T.mat -P \"bnci-2014\"\n","  !wget http://bnci-horizon-2020.eu/database/data-sets/002-2014/S12E.mat -P \"bnci-2014\"\n","  !wget http://bnci-horizon-2020.eu/database/data-sets/002-2014/S13T.mat -P \"bnci-2014\"\n","  !wget http://bnci-horizon-2020.eu/database/data-sets/002-2014/S13E.mat -P \"bnci-2014\"\n","  !wget http://bnci-horizon-2020.eu/database/data-sets/002-2014/S14T.mat -P \"bnci-2014\"\n","  !wget http://bnci-horizon-2020.eu/database/data-sets/002-2014/S14E.mat -P \"bnci-2014\"\n","  \n","  \n","#note just in case, there are duplicates\n","!rm bnci-2014/*.mat.*"],"execution_count":1,"outputs":[{"output_type":"stream","text":["--2019-01-18 00:57:08--  http://bnci-horizon-2020.eu/database/data-sets/002-2014/S01E.mat\n","Resolving bnci-horizon-2020.eu (bnci-horizon-2020.eu)... 91.227.204.35\n","Connecting to bnci-horizon-2020.eu (bnci-horizon-2020.eu)|91.227.204.35|:80... connected.\n","HTTP request sent, awaiting response... 302 Found\n","Location: https://lampx.tugraz.at/~bci/database/002-2014/S01E.mat [following]\n","--2019-01-18 00:57:08--  https://lampx.tugraz.at/~bci/database/002-2014/S01E.mat\n","Resolving lampx.tugraz.at (lampx.tugraz.at)... 129.27.124.207\n","Connecting to lampx.tugraz.at (lampx.tugraz.at)|129.27.124.207|:443... connected.\n","HTTP request sent, awaiting response... 200 OK\n","Length: 23769588 (23M)\n","Saving to: ‘bnci-2014/S01E.mat’\n","\n","S01E.mat            100%[===================>]  22.67M  6.59MB/s    in 5.8s    \n","\n","2019-01-18 00:57:15 (3.92 MB/s) - ‘bnci-2014/S01E.mat’ saved [23769588/23769588]\n","\n","--2019-01-18 00:57:15--  http://bnci-horizon-2020.eu/database/data-sets/002-2014/S01T.mat\n","Resolving bnci-horizon-2020.eu (bnci-horizon-2020.eu)... 91.227.204.35\n","Connecting to bnci-horizon-2020.eu (bnci-horizon-2020.eu)|91.227.204.35|:80... connected.\n","HTTP request sent, awaiting response... 302 Found\n","Location: https://lampx.tugraz.at/~bci/database/002-2014/S01T.mat [following]\n","--2019-01-18 00:57:16--  https://lampx.tugraz.at/~bci/database/002-2014/S01T.mat\n","Resolving lampx.tugraz.at (lampx.tugraz.at)... 129.27.124.207\n","Connecting to lampx.tugraz.at (lampx.tugraz.at)|129.27.124.207|:443... connected.\n","HTTP request sent, awaiting response... 200 OK\n","Length: 39794870 (38M)\n","Saving to: ‘bnci-2014/S01T.mat’\n","\n","S01T.mat            100%[===================>]  37.95M  10.8MB/s    in 6.6s    \n","\n","2019-01-18 00:57:23 (5.71 MB/s) - ‘bnci-2014/S01T.mat’ saved [39794870/39794870]\n","\n","--2019-01-18 00:57:24--  http://bnci-horizon-2020.eu/database/data-sets/002-2014/S02T.mat\n","Resolving bnci-horizon-2020.eu (bnci-horizon-2020.eu)... 91.227.204.35\n","Connecting to bnci-horizon-2020.eu (bnci-horizon-2020.eu)|91.227.204.35|:80... connected.\n","HTTP request sent, awaiting response... 302 Found\n","Location: https://lampx.tugraz.at/~bci/database/002-2014/S02T.mat [following]\n","--2019-01-18 00:57:24--  https://lampx.tugraz.at/~bci/database/002-2014/S02T.mat\n","Resolving lampx.tugraz.at (lampx.tugraz.at)... 129.27.124.207\n","Connecting to lampx.tugraz.at (lampx.tugraz.at)|129.27.124.207|:443... connected.\n","HTTP request sent, awaiting response... 200 OK\n","Length: 38364523 (37M)\n","Saving to: ‘bnci-2014/S02T.mat’\n","\n","S02T.mat            100%[===================>]  36.59M  10.5MB/s    in 6.3s    \n","\n","2019-01-18 00:57:31 (5.81 MB/s) - ‘bnci-2014/S02T.mat’ saved [38364523/38364523]\n","\n","--2019-01-18 00:57:31--  http://bnci-horizon-2020.eu/database/data-sets/002-2014/S02E.mat\n","Resolving bnci-horizon-2020.eu (bnci-horizon-2020.eu)... 91.227.204.35\n","Connecting to bnci-horizon-2020.eu (bnci-horizon-2020.eu)|91.227.204.35|:80... connected.\n","HTTP request sent, awaiting response... 302 Found\n","Location: https://lampx.tugraz.at/~bci/database/002-2014/S02E.mat [following]\n","--2019-01-18 00:57:32--  https://lampx.tugraz.at/~bci/database/002-2014/S02E.mat\n","Resolving lampx.tugraz.at (lampx.tugraz.at)... 129.27.124.207\n","Connecting to lampx.tugraz.at (lampx.tugraz.at)|129.27.124.207|:443... connected.\n","HTTP request sent, awaiting response... 200 OK\n","Length: 22998442 (22M)\n","Saving to: ‘bnci-2014/S02E.mat’\n","\n","S02E.mat            100%[===================>]  21.93M  6.43MB/s    in 5.3s    \n","\n","2019-01-18 00:57:38 (4.14 MB/s) - ‘bnci-2014/S02E.mat’ saved [22998442/22998442]\n","\n","--2019-01-18 00:57:38--  http://bnci-horizon-2020.eu/database/data-sets/002-2014/S03T.mat\n","Resolving bnci-horizon-2020.eu (bnci-horizon-2020.eu)... 91.227.204.35\n","Connecting to bnci-horizon-2020.eu (bnci-horizon-2020.eu)|91.227.204.35|:80... connected.\n","HTTP request sent, awaiting response... 302 Found\n","Location: https://lampx.tugraz.at/~bci/database/002-2014/S03T.mat [following]\n","--2019-01-18 00:57:39--  https://lampx.tugraz.at/~bci/database/002-2014/S03T.mat\n","Resolving lampx.tugraz.at (lampx.tugraz.at)... 129.27.124.207\n","Connecting to lampx.tugraz.at (lampx.tugraz.at)|129.27.124.207|:443... connected.\n","HTTP request sent, awaiting response... 200 OK\n","Length: 39739945 (38M)\n","Saving to: ‘bnci-2014/S03T.mat’\n","\n","S03T.mat            100%[===================>]  37.90M  10.9MB/s    in 6.6s    \n","\n","2019-01-18 00:57:46 (5.75 MB/s) - ‘bnci-2014/S03T.mat’ saved [39739945/39739945]\n","\n","--2019-01-18 00:57:46--  http://bnci-horizon-2020.eu/database/data-sets/002-2014/S03E.mat\n","Resolving bnci-horizon-2020.eu (bnci-horizon-2020.eu)... 91.227.204.35\n","Connecting to bnci-horizon-2020.eu (bnci-horizon-2020.eu)|91.227.204.35|:80... connected.\n","HTTP request sent, awaiting response... 302 Found\n","Location: https://lampx.tugraz.at/~bci/database/002-2014/S03E.mat [following]\n","--2019-01-18 00:57:47--  https://lampx.tugraz.at/~bci/database/002-2014/S03E.mat\n","Resolving lampx.tugraz.at (lampx.tugraz.at)... 129.27.124.207\n","Connecting to lampx.tugraz.at (lampx.tugraz.at)|129.27.124.207|:443... connected.\n","HTTP request sent, awaiting response... 200 OK\n","Length: 23797275 (23M)\n","Saving to: ‘bnci-2014/S03E.mat’\n","\n","S03E.mat            100%[===================>]  22.69M  6.52MB/s    in 5.5s    \n","\n","2019-01-18 00:57:53 (4.09 MB/s) - ‘bnci-2014/S03E.mat’ saved [23797275/23797275]\n","\n","--2019-01-18 00:57:53--  http://bnci-horizon-2020.eu/database/data-sets/002-2014/S04T.mat\n","Resolving bnci-horizon-2020.eu (bnci-horizon-2020.eu)... 91.227.204.35\n","Connecting to bnci-horizon-2020.eu (bnci-horizon-2020.eu)|91.227.204.35|:80... connected.\n","HTTP request sent, awaiting response... 302 Found\n","Location: https://lampx.tugraz.at/~bci/database/002-2014/S04T.mat [following]\n","--2019-01-18 00:57:54--  https://lampx.tugraz.at/~bci/database/002-2014/S04T.mat\n","Resolving lampx.tugraz.at (lampx.tugraz.at)... 129.27.124.207\n","Connecting to lampx.tugraz.at (lampx.tugraz.at)|129.27.124.207|:443... connected.\n","HTTP request sent, awaiting response... 200 OK\n","Length: 39607931 (38M)\n","Saving to: ‘bnci-2014/S04T.mat’\n","\n","S04T.mat            100%[===================>]  37.77M  10.9MB/s    in 6.7s    \n","\n","2019-01-18 00:58:01 (5.61 MB/s) - ‘bnci-2014/S04T.mat’ saved [39607931/39607931]\n","\n","--2019-01-18 00:58:02--  http://bnci-horizon-2020.eu/database/data-sets/002-2014/S04E.mat\n","Resolving bnci-horizon-2020.eu (bnci-horizon-2020.eu)... 91.227.204.35\n","Connecting to bnci-horizon-2020.eu (bnci-horizon-2020.eu)|91.227.204.35|:80... connected.\n","HTTP request sent, awaiting response... 302 Found\n","Location: https://lampx.tugraz.at/~bci/database/002-2014/S04E.mat [following]\n","--2019-01-18 00:58:02--  https://lampx.tugraz.at/~bci/database/002-2014/S04E.mat\n","Resolving lampx.tugraz.at (lampx.tugraz.at)... 129.27.124.207\n","Connecting to lampx.tugraz.at (lampx.tugraz.at)|129.27.124.207|:443... connected.\n","HTTP request sent, awaiting response... 200 OK\n","Length: 23752764 (23M)\n","Saving to: ‘bnci-2014/S04E.mat’\n","\n","S04E.mat            100%[===================>]  22.65M  6.61MB/s    in 5.6s    \n","\n","2019-01-18 00:58:08 (4.04 MB/s) - ‘bnci-2014/S04E.mat’ saved [23752764/23752764]\n","\n","--2019-01-18 00:58:09--  http://bnci-horizon-2020.eu/database/data-sets/002-2014/S05T.mat\n","Resolving bnci-horizon-2020.eu (bnci-horizon-2020.eu)... 91.227.204.35\n","Connecting to bnci-horizon-2020.eu (bnci-horizon-2020.eu)|91.227.204.35|:80... connected.\n","HTTP request sent, awaiting response... 302 Found\n","Location: https://lampx.tugraz.at/~bci/database/002-2014/S05T.mat [following]\n","--2019-01-18 00:58:09--  https://lampx.tugraz.at/~bci/database/002-2014/S05T.mat\n","Resolving lampx.tugraz.at (lampx.tugraz.at)... 129.27.124.207\n","Connecting to lampx.tugraz.at (lampx.tugraz.at)|129.27.124.207|:443... connected.\n","HTTP request sent, awaiting response... 200 OK\n","Length: 39091212 (37M)\n","Saving to: ‘bnci-2014/S05T.mat’\n","\n","S05T.mat            100%[===================>]  37.28M  10.8MB/s    in 6.6s    \n","\n","2019-01-18 00:58:16 (5.68 MB/s) - ‘bnci-2014/S05T.mat’ saved [39091212/39091212]\n","\n","--2019-01-18 00:58:17--  http://bnci-horizon-2020.eu/database/data-sets/002-2014/S05E.mat\n","Resolving bnci-horizon-2020.eu (bnci-horizon-2020.eu)... 91.227.204.35\n","Connecting to bnci-horizon-2020.eu (bnci-horizon-2020.eu)|91.227.204.35|:80... connected.\n","HTTP request sent, awaiting response... 302 Found\n","Location: https://lampx.tugraz.at/~bci/database/002-2014/S05E.mat [following]\n","--2019-01-18 00:58:17--  https://lampx.tugraz.at/~bci/database/002-2014/S05E.mat\n","Resolving lampx.tugraz.at (lampx.tugraz.at)... 129.27.124.207\n","Connecting to lampx.tugraz.at (lampx.tugraz.at)|129.27.124.207|:443... connected.\n","HTTP request sent, awaiting response... 200 OK\n","Length: 23628634 (23M)\n","Saving to: ‘bnci-2014/S05E.mat’\n","\n","S05E.mat            100%[===================>]  22.53M  6.66MB/s    in 5.9s    \n","\n","2019-01-18 00:58:24 (3.83 MB/s) - ‘bnci-2014/S05E.mat’ saved [23628634/23628634]\n","\n","--2019-01-18 00:58:24--  http://bnci-horizon-2020.eu/database/data-sets/002-2014/S06T.mat\n","Resolving bnci-horizon-2020.eu (bnci-horizon-2020.eu)... 91.227.204.35\n","Connecting to bnci-horizon-2020.eu (bnci-horizon-2020.eu)|91.227.204.35|:80... connected.\n","HTTP request sent, awaiting response... 302 Found\n","Location: https://lampx.tugraz.at/~bci/database/002-2014/S06T.mat [following]\n","--2019-01-18 00:58:25--  https://lampx.tugraz.at/~bci/database/002-2014/S06T.mat\n","Resolving lampx.tugraz.at (lampx.tugraz.at)... 129.27.124.207\n","Connecting to lampx.tugraz.at (lampx.tugraz.at)|129.27.124.207|:443... connected.\n","HTTP request sent, awaiting response... 200 OK\n","Length: 40027626 (38M)\n","Saving to: ‘bnci-2014/S06T.mat’\n","\n","S06T.mat            100%[===================>]  38.17M  10.9MB/s    in 6.5s    \n","\n","2019-01-18 00:58:32 (5.90 MB/s) - ‘bnci-2014/S06T.mat’ saved [40027626/40027626]\n","\n","--2019-01-18 00:58:32--  http://bnci-horizon-2020.eu/database/data-sets/002-2014/S06E.mat\n","Resolving bnci-horizon-2020.eu (bnci-horizon-2020.eu)... 91.227.204.35\n","Connecting to bnci-horizon-2020.eu (bnci-horizon-2020.eu)|91.227.204.35|:80... connected.\n","HTTP request sent, awaiting response... 302 Found\n","Location: https://lampx.tugraz.at/~bci/database/002-2014/S06E.mat [following]\n","--2019-01-18 00:58:33--  https://lampx.tugraz.at/~bci/database/002-2014/S06E.mat\n","Resolving lampx.tugraz.at (lampx.tugraz.at)... 129.27.124.207\n","Connecting to lampx.tugraz.at (lampx.tugraz.at)|129.27.124.207|:443... connected.\n","HTTP request sent, awaiting response... 200 OK\n","Length: 23850651 (23M)\n","Saving to: ‘bnci-2014/S06E.mat’\n","\n","S06E.mat            100%[===================>]  22.75M  6.65MB/s    in 5.6s    \n","\n","2019-01-18 00:58:39 (4.05 MB/s) - ‘bnci-2014/S06E.mat’ saved [23850651/23850651]\n","\n","--2019-01-18 00:58:40--  http://bnci-horizon-2020.eu/database/data-sets/002-2014/S07T.mat\n","Resolving bnci-horizon-2020.eu (bnci-horizon-2020.eu)... 91.227.204.35\n","Connecting to bnci-horizon-2020.eu (bnci-horizon-2020.eu)|91.227.204.35|:80... connected.\n","HTTP request sent, awaiting response... 302 Found\n","Location: https://lampx.tugraz.at/~bci/database/002-2014/S07T.mat [following]\n","--2019-01-18 00:58:40--  https://lampx.tugraz.at/~bci/database/002-2014/S07T.mat\n","Resolving lampx.tugraz.at (lampx.tugraz.at)... 129.27.124.207\n","Connecting to lampx.tugraz.at (lampx.tugraz.at)|129.27.124.207|:443... connected.\n","HTTP request sent, awaiting response... 200 OK\n","Length: 40261257 (38M)\n","Saving to: ‘bnci-2014/S07T.mat’\n","\n","S07T.mat            100%[===================>]  38.40M  11.0MB/s    in 6.8s    \n","\n","2019-01-18 00:58:47 (5.69 MB/s) - ‘bnci-2014/S07T.mat’ saved [40261257/40261257]\n","\n","--2019-01-18 00:58:48--  http://bnci-horizon-2020.eu/database/data-sets/002-2014/S07E.mat\n","Resolving bnci-horizon-2020.eu (bnci-horizon-2020.eu)... 91.227.204.35\n","Connecting to bnci-horizon-2020.eu (bnci-horizon-2020.eu)|91.227.204.35|:80... connected.\n","HTTP request sent, awaiting response... 302 Found\n","Location: https://lampx.tugraz.at/~bci/database/002-2014/S07E.mat [following]\n","--2019-01-18 00:58:48--  https://lampx.tugraz.at/~bci/database/002-2014/S07E.mat\n","Resolving lampx.tugraz.at (lampx.tugraz.at)... 129.27.124.207\n","Connecting to lampx.tugraz.at (lampx.tugraz.at)|129.27.124.207|:443... connected.\n","HTTP request sent, awaiting response... 200 OK\n","Length: 23997847 (23M)\n","Saving to: ‘bnci-2014/S07E.mat’\n","\n","S07E.mat            100%[===================>]  22.89M  6.70MB/s    in 5.8s    \n","\n","2019-01-18 00:58:55 (3.97 MB/s) - ‘bnci-2014/S07E.mat’ saved [23997847/23997847]\n","\n","--2019-01-18 00:58:55--  http://bnci-horizon-2020.eu/database/data-sets/002-2014/S08T.mat\n","Resolving bnci-horizon-2020.eu (bnci-horizon-2020.eu)... 91.227.204.35\n","Connecting to bnci-horizon-2020.eu (bnci-horizon-2020.eu)|91.227.204.35|:80... connected.\n","HTTP request sent, awaiting response... 302 Found\n","Location: https://lampx.tugraz.at/~bci/database/002-2014/S08T.mat [following]\n","--2019-01-18 00:58:56--  https://lampx.tugraz.at/~bci/database/002-2014/S08T.mat\n","Resolving lampx.tugraz.at (lampx.tugraz.at)... 129.27.124.207\n","Connecting to lampx.tugraz.at (lampx.tugraz.at)|129.27.124.207|:443... connected.\n","HTTP request sent, awaiting response... 200 OK\n","Length: 39735612 (38M)\n","Saving to: ‘bnci-2014/S08T.mat’\n","\n","S08T.mat            100%[===================>]  37.89M  10.9MB/s    in 6.4s    \n","\n","2019-01-18 00:59:03 (5.90 MB/s) - ‘bnci-2014/S08T.mat’ saved [39735612/39735612]\n","\n","--2019-01-18 00:59:03--  http://bnci-horizon-2020.eu/database/data-sets/002-2014/S08E.mat\n","Resolving bnci-horizon-2020.eu (bnci-horizon-2020.eu)... 91.227.204.35\n","Connecting to bnci-horizon-2020.eu (bnci-horizon-2020.eu)|91.227.204.35|:80... connected.\n","HTTP request sent, awaiting response... 302 Found\n","Location: https://lampx.tugraz.at/~bci/database/002-2014/S08E.mat [following]\n","--2019-01-18 00:59:04--  https://lampx.tugraz.at/~bci/database/002-2014/S08E.mat\n","Resolving lampx.tugraz.at (lampx.tugraz.at)... 129.27.124.207\n","Connecting to lampx.tugraz.at (lampx.tugraz.at)|129.27.124.207|:443... connected.\n","HTTP request sent, awaiting response... 200 OK\n","Length: 23791571 (23M)\n","Saving to: ‘bnci-2014/S08E.mat’\n","\n","S08E.mat            100%[===================>]  22.69M  6.68MB/s    in 5.4s    \n","\n","2019-01-18 00:59:10 (4.18 MB/s) - ‘bnci-2014/S08E.mat’ saved [23791571/23791571]\n","\n","--2019-01-18 00:59:10--  http://bnci-horizon-2020.eu/database/data-sets/002-2014/S09T.mat\n","Resolving bnci-horizon-2020.eu (bnci-horizon-2020.eu)... 91.227.204.35\n","Connecting to bnci-horizon-2020.eu (bnci-horizon-2020.eu)|91.227.204.35|:80... connected.\n","HTTP request sent, awaiting response... 302 Found\n","Location: https://lampx.tugraz.at/~bci/database/002-2014/S09T.mat [following]\n","--2019-01-18 00:59:11--  https://lampx.tugraz.at/~bci/database/002-2014/S09T.mat\n","Resolving lampx.tugraz.at (lampx.tugraz.at)... 129.27.124.207\n","Connecting to lampx.tugraz.at (lampx.tugraz.at)|129.27.124.207|:443... connected.\n","HTTP request sent, awaiting response... 200 OK\n","Length: 39805150 (38M)\n","Saving to: ‘bnci-2014/S09T.mat’\n","\n","S09T.mat            100%[===================>]  37.96M  11.0MB/s    in 6.4s    \n","\n","2019-01-18 00:59:18 (5.92 MB/s) - ‘bnci-2014/S09T.mat’ saved [39805150/39805150]\n","\n","--2019-01-18 00:59:18--  http://bnci-horizon-2020.eu/database/data-sets/002-2014/S09E.mat\n","Resolving bnci-horizon-2020.eu (bnci-horizon-2020.eu)... 91.227.204.35\n","Connecting to bnci-horizon-2020.eu (bnci-horizon-2020.eu)|91.227.204.35|:80... connected.\n","HTTP request sent, awaiting response... 302 Found\n","Location: https://lampx.tugraz.at/~bci/database/002-2014/S09E.mat [following]\n","--2019-01-18 00:59:19--  https://lampx.tugraz.at/~bci/database/002-2014/S09E.mat\n","Resolving lampx.tugraz.at (lampx.tugraz.at)... 129.27.124.207\n","Connecting to lampx.tugraz.at (lampx.tugraz.at)|129.27.124.207|:443... connected.\n","HTTP request sent, awaiting response... 200 OK\n","Length: 23610622 (23M)\n","Saving to: ‘bnci-2014/S09E.mat’\n","\n","S09E.mat            100%[===================>]  22.52M  6.60MB/s    in 5.6s    \n","\n","2019-01-18 00:59:25 (4.01 MB/s) - ‘bnci-2014/S09E.mat’ saved [23610622/23610622]\n","\n","--2019-01-18 00:59:25--  http://bnci-horizon-2020.eu/database/data-sets/002-2014/S10T.mat\n","Resolving bnci-horizon-2020.eu (bnci-horizon-2020.eu)... 91.227.204.35\n","Connecting to bnci-horizon-2020.eu (bnci-horizon-2020.eu)|91.227.204.35|:80... connected.\n","HTTP request sent, awaiting response... 302 Found\n","Location: https://lampx.tugraz.at/~bci/database/002-2014/S10T.mat [following]\n","--2019-01-18 00:59:26--  https://lampx.tugraz.at/~bci/database/002-2014/S10T.mat\n","Resolving lampx.tugraz.at (lampx.tugraz.at)... 129.27.124.207\n","Connecting to lampx.tugraz.at (lampx.tugraz.at)|129.27.124.207|:443... connected.\n","HTTP request sent, awaiting response... 200 OK\n","Length: 39871971 (38M)\n","Saving to: ‘bnci-2014/S10T.mat’\n","\n","S10T.mat            100%[===================>]  38.02M  11.0MB/s    in 6.7s    \n","\n","2019-01-18 00:59:33 (5.66 MB/s) - ‘bnci-2014/S10T.mat’ saved [39871971/39871971]\n","\n","--2019-01-18 00:59:34--  http://bnci-horizon-2020.eu/database/data-sets/002-2014/S10E.mat\n","Resolving bnci-horizon-2020.eu (bnci-horizon-2020.eu)... 91.227.204.35\n","Connecting to bnci-horizon-2020.eu (bnci-horizon-2020.eu)|91.227.204.35|:80... connected.\n","HTTP request sent, awaiting response... 302 Found\n","Location: https://lampx.tugraz.at/~bci/database/002-2014/S10E.mat [following]\n","--2019-01-18 00:59:35--  https://lampx.tugraz.at/~bci/database/002-2014/S10E.mat\n","Resolving lampx.tugraz.at (lampx.tugraz.at)... 129.27.124.207\n","Connecting to lampx.tugraz.at (lampx.tugraz.at)|129.27.124.207|:443... connected.\n","HTTP request sent, awaiting response... 200 OK\n","Length: 23750112 (23M)\n","Saving to: ‘bnci-2014/S10E.mat’\n","\n","S10E.mat            100%[===================>]  22.65M  6.69MB/s    in 5.3s    \n","\n","2019-01-18 00:59:41 (4.29 MB/s) - ‘bnci-2014/S10E.mat’ saved [23750112/23750112]\n","\n","--2019-01-18 00:59:41--  http://bnci-horizon-2020.eu/database/data-sets/002-2014/S11T.mat\n","Resolving bnci-horizon-2020.eu (bnci-horizon-2020.eu)... 91.227.204.35\n","Connecting to bnci-horizon-2020.eu (bnci-horizon-2020.eu)|91.227.204.35|:80... connected.\n","HTTP request sent, awaiting response... 302 Found\n","Location: https://lampx.tugraz.at/~bci/database/002-2014/S11T.mat [following]\n","--2019-01-18 00:59:41--  https://lampx.tugraz.at/~bci/database/002-2014/S11T.mat\n","Resolving lampx.tugraz.at (lampx.tugraz.at)... 129.27.124.207\n","Connecting to lampx.tugraz.at (lampx.tugraz.at)|129.27.124.207|:443... connected.\n","HTTP request sent, awaiting response... 200 OK\n","Length: 40140184 (38M)\n","Saving to: ‘bnci-2014/S11T.mat’\n","\n","S11T.mat            100%[===================>]  38.28M  11.0MB/s    in 6.6s    \n","\n","2019-01-18 00:59:48 (5.79 MB/s) - ‘bnci-2014/S11T.mat’ saved [40140184/40140184]\n","\n","--2019-01-18 00:59:49--  http://bnci-horizon-2020.eu/database/data-sets/002-2014/S11E.mat\n","Resolving bnci-horizon-2020.eu (bnci-horizon-2020.eu)... 91.227.204.35\n","Connecting to bnci-horizon-2020.eu (bnci-horizon-2020.eu)|91.227.204.35|:80... connected.\n","HTTP request sent, awaiting response... 302 Found\n","Location: https://lampx.tugraz.at/~bci/database/002-2014/S11E.mat [following]\n","--2019-01-18 00:59:49--  https://lampx.tugraz.at/~bci/database/002-2014/S11E.mat\n","Resolving lampx.tugraz.at (lampx.tugraz.at)... 129.27.124.207\n","Connecting to lampx.tugraz.at (lampx.tugraz.at)|129.27.124.207|:443... connected.\n","HTTP request sent, awaiting response... 200 OK\n","Length: 24171700 (23M)\n","Saving to: ‘bnci-2014/S11E.mat’\n","\n","S11E.mat            100%[===================>]  23.05M  6.87MB/s    in 5.7s    \n","\n","2019-01-18 00:59:56 (4.04 MB/s) - ‘bnci-2014/S11E.mat’ saved [24171700/24171700]\n","\n","--2019-01-18 00:59:56--  http://bnci-horizon-2020.eu/database/data-sets/002-2014/S12T.mat\n","Resolving bnci-horizon-2020.eu (bnci-horizon-2020.eu)... 91.227.204.35\n","Connecting to bnci-horizon-2020.eu (bnci-horizon-2020.eu)|91.227.204.35|:80... connected.\n","HTTP request sent, awaiting response... 302 Found\n","Location: https://lampx.tugraz.at/~bci/database/002-2014/S12T.mat [following]\n","--2019-01-18 00:59:56--  https://lampx.tugraz.at/~bci/database/002-2014/S12T.mat\n","Resolving lampx.tugraz.at (lampx.tugraz.at)... 129.27.124.207\n","Connecting to lampx.tugraz.at (lampx.tugraz.at)|129.27.124.207|:443... connected.\n","HTTP request sent, awaiting response... 200 OK\n","Length: 40093093 (38M)\n","Saving to: ‘bnci-2014/S12T.mat’\n","\n","S12T.mat            100%[===================>]  38.24M  11.1MB/s    in 6.7s    \n","\n","2019-01-18 01:00:04 (5.69 MB/s) - ‘bnci-2014/S12T.mat’ saved [40093093/40093093]\n","\n","--2019-01-18 01:00:04--  http://bnci-horizon-2020.eu/database/data-sets/002-2014/S12E.mat\n","Resolving bnci-horizon-2020.eu (bnci-horizon-2020.eu)... 91.227.204.35\n","Connecting to bnci-horizon-2020.eu (bnci-horizon-2020.eu)|91.227.204.35|:80... connected.\n","HTTP request sent, awaiting response... 302 Found\n","Location: https://lampx.tugraz.at/~bci/database/002-2014/S12E.mat [following]\n","--2019-01-18 01:00:04--  https://lampx.tugraz.at/~bci/database/002-2014/S12E.mat\n","Resolving lampx.tugraz.at (lampx.tugraz.at)... 129.27.124.207\n","Connecting to lampx.tugraz.at (lampx.tugraz.at)|129.27.124.207|:443... connected.\n","HTTP request sent, awaiting response... 200 OK\n","Length: 23905075 (23M)\n","Saving to: ‘bnci-2014/S12E.mat’\n","\n","S12E.mat            100%[===================>]  22.80M  6.66MB/s    in 5.3s    \n","\n","2019-01-18 01:00:10 (4.30 MB/s) - ‘bnci-2014/S12E.mat’ saved [23905075/23905075]\n","\n","--2019-01-18 01:00:11--  http://bnci-horizon-2020.eu/database/data-sets/002-2014/S13T.mat\n","Resolving bnci-horizon-2020.eu (bnci-horizon-2020.eu)... 91.227.204.35\n","Connecting to bnci-horizon-2020.eu (bnci-horizon-2020.eu)|91.227.204.35|:80... connected.\n","HTTP request sent, awaiting response... 302 Found\n","Location: https://lampx.tugraz.at/~bci/database/002-2014/S13T.mat [following]\n","--2019-01-18 01:00:11--  https://lampx.tugraz.at/~bci/database/002-2014/S13T.mat\n","Resolving lampx.tugraz.at (lampx.tugraz.at)... 129.27.124.207\n","Connecting to lampx.tugraz.at (lampx.tugraz.at)|129.27.124.207|:443... connected.\n","HTTP request sent, awaiting response... 200 OK\n","Length: 39819174 (38M)\n","Saving to: ‘bnci-2014/S13T.mat’\n","\n","S13T.mat            100%[===================>]  37.97M  10.7MB/s    in 6.5s    \n","\n","2019-01-18 01:00:18 (5.86 MB/s) - ‘bnci-2014/S13T.mat’ saved [39819174/39819174]\n","\n","--2019-01-18 01:00:19--  http://bnci-horizon-2020.eu/database/data-sets/002-2014/S13E.mat\n","Resolving bnci-horizon-2020.eu (bnci-horizon-2020.eu)... 91.227.204.35\n","Connecting to bnci-horizon-2020.eu (bnci-horizon-2020.eu)|91.227.204.35|:80... connected.\n","HTTP request sent, awaiting response... 302 Found\n","Location: https://lampx.tugraz.at/~bci/database/002-2014/S13E.mat [following]\n","--2019-01-18 01:00:20--  https://lampx.tugraz.at/~bci/database/002-2014/S13E.mat\n","Resolving lampx.tugraz.at (lampx.tugraz.at)... 129.27.124.207\n","Connecting to lampx.tugraz.at (lampx.tugraz.at)|129.27.124.207|:443... connected.\n","HTTP request sent, awaiting response... 200 OK\n","Length: 23669359 (23M)\n","Saving to: ‘bnci-2014/S13E.mat’\n","\n","S13E.mat            100%[===================>]  22.57M  6.77MB/s    in 5.4s    \n","\n","2019-01-18 01:00:26 (4.21 MB/s) - ‘bnci-2014/S13E.mat’ saved [23669359/23669359]\n","\n","--2019-01-18 01:00:26--  http://bnci-horizon-2020.eu/database/data-sets/002-2014/S14T.mat\n","Resolving bnci-horizon-2020.eu (bnci-horizon-2020.eu)... 91.227.204.35\n","Connecting to bnci-horizon-2020.eu (bnci-horizon-2020.eu)|91.227.204.35|:80... connected.\n","HTTP request sent, awaiting response... 302 Found\n","Location: https://lampx.tugraz.at/~bci/database/002-2014/S14T.mat [following]\n","--2019-01-18 01:00:26--  https://lampx.tugraz.at/~bci/database/002-2014/S14T.mat\n","Resolving lampx.tugraz.at (lampx.tugraz.at)... 129.27.124.207\n","Connecting to lampx.tugraz.at (lampx.tugraz.at)|129.27.124.207|:443... connected.\n","HTTP request sent, awaiting response... 200 OK\n","Length: 39859134 (38M)\n","Saving to: ‘bnci-2014/S14T.mat’\n","\n","S14T.mat            100%[===================>]  38.01M  11.0MB/s    in 6.3s    \n","\n","2019-01-18 01:00:33 (6.07 MB/s) - ‘bnci-2014/S14T.mat’ saved [39859134/39859134]\n","\n","--2019-01-18 01:00:34--  http://bnci-horizon-2020.eu/database/data-sets/002-2014/S14E.mat\n","Resolving bnci-horizon-2020.eu (bnci-horizon-2020.eu)... 91.227.204.35\n","Connecting to bnci-horizon-2020.eu (bnci-horizon-2020.eu)|91.227.204.35|:80... connected.\n","HTTP request sent, awaiting response... 302 Found\n","Location: https://lampx.tugraz.at/~bci/database/002-2014/S14E.mat [following]\n","--2019-01-18 01:00:34--  https://lampx.tugraz.at/~bci/database/002-2014/S14E.mat\n","Resolving lampx.tugraz.at (lampx.tugraz.at)... 129.27.124.207\n","Connecting to lampx.tugraz.at (lampx.tugraz.at)|129.27.124.207|:443... connected.\n","HTTP request sent, awaiting response... 200 OK\n","Length: 23970887 (23M)\n","Saving to: ‘bnci-2014/S14E.mat’\n","\n","S14E.mat            100%[===================>]  22.86M  6.86MB/s    in 5.4s    \n","\n","2019-01-18 01:00:40 (4.26 MB/s) - ‘bnci-2014/S14E.mat’ saved [23970887/23970887]\n","\n","rm: cannot remove 'bnci-2014/*.mat.*': No such file or directory\n"],"name":"stdout"}]},{"metadata":{"id":"irukm4V4hvQ8","colab_type":"code","colab":{}},"cell_type":"code","source":["# Installation\n","# NOTE: Should only be called once\n","\n","#install brain decode\n","!pip install braindecode -q\n","\n","# install pytorch\n","# ref: http://pytorch.org/\n","from os import path\n","from wheel.pep425tags import get_abbr_impl, get_impl_ver, get_abi_tag\n","platform = '{}{}-{}'.format(get_abbr_impl(), get_impl_ver(), get_abi_tag())\n","\n","accelerator = 'cu80' if path.exists('/opt/bin/nvidia-smi') else 'cpu'\n","\n","#!pip install -q http://download.pytorch.org/whl/{accelerator}/torch-0.3.0.post4-{platform}-linux_x86_64.whl torchvision\n","!pip install -q http://download.pytorch.org/whl/{accelerator}/torch-0.4.0-{platform}-linux_x86_64.whl torchvision\n","#  cu91/torch-0.4.0-cp36-cp36m-linux_x86_64.whl\n","import torch\n","\n"],"execution_count":0,"outputs":[]},{"metadata":{"id":"W76bxgMvXNqo","colab_type":"code","outputId":"4af507ab-8229-4246-eb27-f9b450beadce","executionInfo":{"status":"ok","timestamp":1547778597856,"user_tz":300,"elapsed":10855,"user":{"displayName":"TheAtom2626","photoUrl":"","userId":"00378881698832173059"}},"colab":{"base_uri":"https://localhost:8080/","height":88}},"cell_type":"code","source":["\n","import numpy as np\n","import scipy.io as sio\n","\n","DATASET_PATH = \"bnci-2014\"\n","\n","TEST_SUBJECT_IDX = np.array([0]) # needs be\n","VEHICULE_SUBJECTS_IDX = np.array([1,2]) # needs be\n","TO_REMOVE = np.r_[TEST_SUBJECT_IDX,VEHICULE_SUBJECTS_IDX]\n","\n","TEST_SUBJECT_IDX *= 2\n","VEHICULE_SUBJECTS_IDX *= 2\n","TO_REMOVE *= 2\n","\n","TRIAL_WINDOW_LENGTH = 7\n","\n","allSubjects = os.listdir(DATASET_PATH)\n","allSubjects.sort()\n","\n","testSubject = []\n","vehiculeSubject = []\n","\n","TO_REMOVE[::-1].sort()\n","\n","\n","for i in range(TEST_SUBJECT_IDX.shape[0]):\n","    testSubject.append(allSubjects[TEST_SUBJECT_IDX[i]])\n","    testSubject.append(allSubjects[TEST_SUBJECT_IDX[i]+1])\n","    \n","for i in range(VEHICULE_SUBJECTS_IDX.shape[0]):\n","    vehiculeSubject.append(allSubjects[VEHICULE_SUBJECTS_IDX[i]])\n","    vehiculeSubject.append(allSubjects[VEHICULE_SUBJECTS_IDX[i]+1])\n","    \n","testSubject.sort()\n","vehiculeSubject.sort()\n","\n","\n","for i in range(TO_REMOVE.shape[0]):\n","    # double pop to remove *T and *E\n","    allSubjects.pop(TO_REMOVE[i])\n","    allSubjects.pop(TO_REMOVE[i]) \n","\n","print(\"Test subject: \" + repr(testSubject))\n","print(\"Vehicule subjects: \" + repr(vehiculeSubject))\n","print(\"Train subjects: \" + repr(allSubjects))\n","\n","X1 = []\n","y1 = []\n","\n","\n","for f in allSubjects:\n","    # read file\n","    d1T = sio.loadmat(DATASET_PATH + \"/\" + f)\n","    \n","    samplingRate = d1T['data'][0][0][0][0][3][0][0]\n","    trialLength = TRIAL_WINDOW_LENGTH*samplingRate\n","\n","    # run through all training runs\n","    for run in range(len(d1T['data'][0])):\n","        y1.append(d1T['data'][0][run][0][0][2][0]) # labels\n","        timestamps = d1T['data'][0][run][0][0][1][0] # timestamps\n","        rawData = d1T['data'][0][run][0][0][0].transpose() # chan x data\n","\n","        # parse out data based on timestamps\n","        for start in timestamps:\n","            end = start + trialLength\n","            X1.append(rawData[:,start:end]) #15 x 2560\n","\n","    del rawData\n","    del d1T\n","\n","# arrange data into num7py arrays\n","# also torch expect float32 for samples\n","# and int64 for labels {0,1}\n","X1 = np.array(X1).astype(np.float32)\n","y1 = (np.array(y1).flatten()-1).astype(np.int64)\n","\n","# rand permute dataset\n","idx = np.random.permutation(X1.shape[0])\n","X1 = X1[idx,:,:]\n","y1 = y1[idx]\n","\n","\n","X2 = []\n","y2 = []\n","\n","for f in testSubject:\n","    # read file\n","    d1T = sio.loadmat(DATASET_PATH + \"/\" + f)\n","    \n","    samplingRate = d1T['data'][0][0][0][0][3][0][0]\n","    trialLength = TRIAL_WINDOW_LENGTH*samplingRate\n","\n","    # run through all training runs\n","    for run in range(len(d1T['data'][0])):\n","        y2.append(d1T['data'][0][run][0][0][2][0]) # labels\n","        timestamps = d1T['data'][0][run][0][0][1][0] # timestamps\n","        rawData = d1T['data'][0][run][0][0][0].transpose() # chan x data\n","\n","        # parse out data based on timestamps\n","        for start in timestamps:\n","            end = start + trialLength\n","            X2.append(rawData[:,start:end]) #15 x 2560\n","\n","    del rawData\n","    del d1T\n","\n","X2 = np.array(X2).astype(np.float32)\n","y2 = (np.array(y2).flatten()-1).astype(np.int64)\n","\n","\n","# rand permute dataset\n","idx = np.random.permutation(X2.shape[0])\n","\n","X2 = X2[idx,:,:]\n","y2 = y2[idx]\n","\n","\n","\n","X3 = []\n","y3 = []\n","\n","for f in testSubject:\n","    # read file\n","    d1T = sio.loadmat(DATASET_PATH + \"/\" + f)\n","    \n","    samplingRate = d1T['data'][0][0][0][0][3][0][0]\n","    trialLength = TRIAL_WINDOW_LENGTH*samplingRate\n","\n","    # run through all training runs\n","    for run in range(len(d1T['data'][0])):\n","        y3.append(d1T['data'][0][run][0][0][2][0]) # labels\n","        timestamps = d1T['data'][0][run][0][0][1][0] # timestamps\n","        rawData = d1T['data'][0][run][0][0][0].transpose() # chan x data\n","\n","        # parse out data based on timestamps\n","        for start in timestamps:\n","            end = start + trialLength\n","            X3.append(rawData[:,start:end]) #15 x 2560\n","\n","    del rawData\n","    del d1T\n","\n","X3 = np.array(X3).astype(np.float32)\n","y3 = (np.array(y3).flatten()-1).astype(np.int64)\n","\n","\n","# rand permute dataset\n","idx = np.random.permutation(X3.shape[0])\n","\n","X3 = X3[idx,:,:]\n","y3 = y3[idx]"],"execution_count":52,"outputs":[{"output_type":"stream","text":["Test subject: ['S01E.mat', 'S01T.mat']\n","Vehicule subjects: ['S02E.mat', 'S02T.mat', 'S03E.mat', 'S03T.mat']\n","Train subjects: ['S04E.mat', 'S04T.mat', 'S05E.mat', 'S05T.mat', 'S06E.mat', 'S06T.mat', 'S07E.mat', 'S07T.mat', 'S08E.mat', 'S08T.mat', 'S09E.mat', 'S09T.mat', 'S10E.mat', 'S10T.mat', 'S11E.mat', 'S11T.mat', 'S12E.mat', 'S12T.mat', 'S13E.mat', 'S13T.mat', 'S14E.mat', 'S14T.mat']\n"],"name":"stdout"}]},{"metadata":{"id":"28HkRdH5d75D","colab_type":"code","colab":{}},"cell_type":"code","source":[""],"execution_count":0,"outputs":[]},{"metadata":{"id":"_TxcLSp10hdO","colab_type":"text"},"cell_type":"markdown","source":[""]},{"metadata":{"id":"3yMxfbtOga2x","colab_type":"code","outputId":"b0b7a528-ad95-44c7-ca54-4706a888fa92","executionInfo":{"status":"ok","timestamp":1547774487142,"user_tz":300,"elapsed":4319,"user":{"displayName":"TheAtom2626","photoUrl":"","userId":"00378881698832173059"}},"colab":{"base_uri":"https://localhost:8080/","height":136}},"cell_type":"code","source":["\n","# if dl-eeg-playground already here, erase\n","!rm -rf dl-eeg-playground\n","!rm -rf brainDecodeSKLearnWrapper\n","\n","!git clone https://github.com/NeuroTechX/dl-eeg-playground.git \n","!mv dl-eeg-playground/brainDecode/towardMoabbIntegration/brainDecodeSKLearnWrapper ."],"execution_count":21,"outputs":[{"output_type":"stream","text":["Cloning into 'dl-eeg-playground'...\n","remote: Enumerating objects: 40, done.\u001b[K\n","remote: Counting objects:   2% (1/40)   \u001b[K\rremote: Counting objects:   5% (2/40)   \u001b[K\rremote: Counting objects:   7% (3/40)   \u001b[K\rremote: Counting objects:  10% (4/40)   \u001b[K\rremote: Counting objects:  12% (5/40)   \u001b[K\rremote: Counting objects:  15% (6/40)   \u001b[K\rremote: Counting objects:  17% (7/40)   \u001b[K\rremote: Counting objects:  20% (8/40)   \u001b[K\rremote: Counting objects:  22% (9/40)   \u001b[K\rremote: Counting objects:  25% (10/40)   \u001b[K\rremote: Counting objects:  27% (11/40)   \u001b[K\rremote: Counting objects:  30% (12/40)   \u001b[K\rremote: Counting objects:  32% (13/40)   \u001b[K\rremote: Counting objects:  35% (14/40)   \u001b[K\rremote: Counting objects:  37% (15/40)   \u001b[K\rremote: Counting objects:  40% (16/40)   \u001b[K\rremote: Counting objects:  42% (17/40)   \u001b[K\rremote: Counting objects:  45% (18/40)   \u001b[K\rremote: Counting objects:  47% (19/40)   \u001b[K\rremote: Counting objects:  50% (20/40)   \u001b[K\rremote: Counting objects:  52% (21/40)   \u001b[K\rremote: Counting objects:  55% (22/40)   \u001b[K\rremote: Counting objects:  57% (23/40)   \u001b[K\rremote: Counting objects:  60% (24/40)   \u001b[K\rremote: Counting objects:  62% (25/40)   \u001b[K\rremote: Counting objects:  65% (26/40)   \u001b[K\rremote: Counting objects:  67% (27/40)   \u001b[K\rremote: Counting objects:  70% (28/40)   \u001b[K\rremote: Counting objects:  72% (29/40)   \u001b[K\rremote: Counting objects:  75% (30/40)   \u001b[K\rremote: Counting objects:  77% (31/40)   \u001b[K\rremote: Counting objects:  80% (32/40)   \u001b[K\rremote: Counting objects:  82% (33/40)   \u001b[K\rremote: Counting objects:  85% (34/40)   \u001b[K\rremote: Counting objects:  87% (35/40)   \u001b[K\rremote: Counting objects:  90% (36/40)   \u001b[K\rremote: Counting objects:  92% (37/40)   \u001b[K\rremote: Counting objects:  95% (38/40)   \u001b[K\rremote: Counting objects:  97% (39/40)   \u001b[K\rremote: Counting objects: 100% (40/40)   \u001b[K\rremote: Counting objects: 100% (40/40), done.\u001b[K\n","remote: Compressing objects:   3% (1/28)   \u001b[K\rremote: Compressing objects:   7% (2/28)   \u001b[K\rremote: Compressing objects:  10% (3/28)   \u001b[K\rremote: Compressing objects:  14% (4/28)   \u001b[K\rremote: Compressing objects:  17% (5/28)   \u001b[K\rremote: Compressing objects:  21% (6/28)   \u001b[K\rremote: Compressing objects:  25% (7/28)   \u001b[K\rremote: Compressing objects:  28% (8/28)   \u001b[K\rremote: Compressing objects:  32% (9/28)   \u001b[K\rremote: Compressing objects:  35% (10/28)   \u001b[K\rremote: Compressing objects:  39% (11/28)   \u001b[K\rremote: Compressing objects:  42% (12/28)   \u001b[K\rremote: Compressing objects:  46% (13/28)   \u001b[K\rremote: Compressing objects:  50% (14/28)   \u001b[K\rremote: Compressing objects:  53% (15/28)   \u001b[K\rremote: Compressing objects:  57% (16/28)   \u001b[K\rremote: Compressing objects:  60% (17/28)   \u001b[K\rremote: Compressing objects:  64% (18/28)   \u001b[K\rremote: Compressing objects:  67% (19/28)   \u001b[K\rremote: Compressing objects:  71% (20/28)   \u001b[K\rremote: Compressing objects:  75% (21/28)   \u001b[K\rremote: Compressing objects:  78% (22/28)   \u001b[K\rremote: Compressing objects:  82% (23/28)   \u001b[K\rremote: Compressing objects:  85% (24/28)   \u001b[K\rremote: Compressing objects:  89% (25/28)   \u001b[K\rremote: Compressing objects:  92% (26/28)   \u001b[K\rremote: Compressing objects:  96% (27/28)   \u001b[K\rremote: Compressing objects: 100% (28/28)   \u001b[K\rremote: Compressing objects: 100% (28/28), done.\u001b[K\n","Receiving objects:   0% (1/301)   \rReceiving objects:   1% (4/301)   \rReceiving objects:   2% (7/301)   \rReceiving objects:   3% (10/301)   \rReceiving objects:   4% (13/301)   \rReceiving objects:   5% (16/301)   \rReceiving objects:   6% (19/301)   \rReceiving objects:   7% (22/301)   \rReceiving objects:   8% (25/301)   \rReceiving objects:   9% (28/301)   \rReceiving objects:  10% (31/301)   \rReceiving objects:  11% (34/301)   \rReceiving objects:  12% (37/301)   \rReceiving objects:  13% (40/301)   \rReceiving objects:  14% (43/301)   \rReceiving objects:  15% (46/301)   \rReceiving objects:  16% (49/301)   \rReceiving objects:  17% (52/301)   \rReceiving objects:  18% (55/301)   \rReceiving objects:  19% (58/301)   \rReceiving objects:  20% (61/301)   \rReceiving objects:  21% (64/301)   \rReceiving objects:  22% (67/301)   \rReceiving objects:  23% (70/301)   \rReceiving objects:  24% (73/301)   \rReceiving objects:  25% (76/301)   \rReceiving objects:  26% (79/301)   \rReceiving objects:  27% (82/301)   \rReceiving objects:  28% (85/301)   \rReceiving objects:  29% (88/301)   \rReceiving objects:  30% (91/301)   \rReceiving objects:  31% (94/301)   \rReceiving objects:  32% (97/301)   \rReceiving objects:  33% (100/301)   \rReceiving objects:  34% (103/301)   \rReceiving objects:  35% (106/301)   \rReceiving objects:  36% (109/301)   \rReceiving objects:  37% (112/301)   \rReceiving objects:  38% (115/301)   \rReceiving objects:  39% (118/301)   \rReceiving objects:  40% (121/301)   \rReceiving objects:  41% (124/301)   \rReceiving objects:  42% (127/301)   \rReceiving objects:  43% (130/301)   \rReceiving objects:  44% (133/301)   \rReceiving objects:  45% (136/301)   \rReceiving objects:  46% (139/301)   \rReceiving objects:  47% (142/301)   \rReceiving objects:  48% (145/301)   \rReceiving objects:  49% (148/301)   \rReceiving objects:  50% (151/301)   \rReceiving objects:  51% (154/301)   \rReceiving objects:  52% (157/301)   \rReceiving objects:  53% (160/301)   \rReceiving objects:  54% (163/301)   \rReceiving objects:  55% (166/301)   \rReceiving objects:  56% (169/301)   \rReceiving objects:  57% (172/301)   \rReceiving objects:  58% (175/301)   \rReceiving objects:  59% (178/301)   \rReceiving objects:  60% (181/301)   \rReceiving objects:  61% (184/301)   \rReceiving objects:  62% (187/301)   \rReceiving objects:  63% (190/301)   \rReceiving objects:  64% (193/301)   \rReceiving objects:  65% (196/301)   \rReceiving objects:  66% (199/301)   \rReceiving objects:  67% (202/301)   \rReceiving objects:  68% (205/301)   \rReceiving objects:  69% (208/301)   \rReceiving objects:  70% (211/301)   \rReceiving objects:  71% (214/301)   \rReceiving objects:  72% (217/301)   \rReceiving objects:  73% (220/301)   \rReceiving objects:  74% (223/301)   \rReceiving objects:  75% (226/301)   \rReceiving objects:  76% (229/301)   \rReceiving objects:  77% (232/301)   \rReceiving objects:  78% (235/301)   \rReceiving objects:  79% (238/301)   \rReceiving objects:  80% (241/301)   \rReceiving objects:  81% (244/301)   \rReceiving objects:  82% (247/301)   \rReceiving objects:  83% (250/301)   \rReceiving objects:  84% (253/301)   \rReceiving objects:  85% (256/301)   \rReceiving objects:  86% (259/301)   \rReceiving objects:  87% (262/301)   \rReceiving objects:  88% (265/301)   \rReceiving objects:  89% (268/301)   \rReceiving objects:  90% (271/301)   \rremote: Total 301 (delta 22), reused 27 (delta 11), pack-reused 261\u001b[K\n","Receiving objects:  91% (274/301)   \rReceiving objects:  92% (277/301)   \rReceiving objects:  93% (280/301)   \rReceiving objects:  94% (283/301)   \rReceiving objects:  95% (286/301)   \rReceiving objects:  96% (289/301)   \rReceiving objects:  97% (292/301)   \rReceiving objects:  98% (295/301)   \rReceiving objects:  99% (298/301)   \rReceiving objects: 100% (301/301)   \rReceiving objects: 100% (301/301), 2.19 MiB | 24.37 MiB/s, done.\n","Resolving deltas:   0% (0/150)   \rResolving deltas:  15% (23/150)   \rResolving deltas:  16% (25/150)   \rResolving deltas:  18% (27/150)   \rResolving deltas:  26% (40/150)   \rResolving deltas:  30% (45/150)   \rResolving deltas:  32% (48/150)   \rResolving deltas:  39% (59/150)   \rResolving deltas:  50% (75/150)   \rResolving deltas:  55% (83/150)   \rResolving deltas:  57% (86/150)   \rResolving deltas:  58% (87/150)   \rResolving deltas:  59% (89/150)   \rResolving deltas:  60% (90/150)   \rResolving deltas:  61% (92/150)   \rResolving deltas:  64% (97/150)   \rResolving deltas:  68% (103/150)   \rResolving deltas:  70% (106/150)   \rResolving deltas:  78% (117/150)   \rResolving deltas:  80% (121/150)   \rResolving deltas:  84% (126/150)   \rResolving deltas:  87% (131/150)   \rResolving deltas:  92% (138/150)   \rResolving deltas:  93% (140/150)   \rResolving deltas:  94% (142/150)   \rResolving deltas:  96% (144/150)   \rResolving deltas:  98% (147/150)   \rResolving deltas: 100% (150/150)   \rResolving deltas: 100% (150/150), done.\n"],"name":"stdout"}]},{"metadata":{"id":"SE3uXH9Zc54-","colab_type":"code","outputId":"61d43a47-40b6-4faa-91f3-40705f431313","executionInfo":{"status":"ok","timestamp":1547778941738,"user_tz":300,"elapsed":351240,"user":{"displayName":"TheAtom2626","photoUrl":"","userId":"00378881698832173059"}},"colab":{"base_uri":"https://localhost:8080/","height":8568}},"cell_type":"code","source":["import sys\n","sys.path.append(\"brainDecode/towardMoabbIntegration\")\n","\n","# load the general network Trainer\n","from brainDecodeSKLearnWrapper.ShallowFBCSPNet_GeneralTrainer import ShallowFBCSPNet_GeneralTrainer\n","\n","\n","\n","classifier = ShallowFBCSPNet_GeneralTrainer(nb_epoch=100)\n","classifier.fit(X1,y1)\n"],"execution_count":53,"outputs":[{"output_type":"stream","text":["Epoch 0\n","Train  Loss: 0.76184\n","Train  Accuracy: 53.2%\n","Test   Loss: 0.81317\n","Test   Accuracy: 53.6%\n","Epoch 1\n","Train  Loss: 0.78738\n","Train  Accuracy: 55.5%\n","Test   Loss: 0.87383\n","Test   Accuracy: 48.2%\n","Epoch 2\n","Train  Loss: 0.75034\n","Train  Accuracy: 53.4%\n","Test   Loss: 0.80308\n","Test   Accuracy: 50.5%\n","Epoch 3\n","Train  Loss: 0.69683\n","Train  Accuracy: 58.2%\n","Test   Loss: 0.77245\n","Test   Accuracy: 48.6%\n","Epoch 4\n","Train  Loss: 0.83186\n","Train  Accuracy: 52.0%\n","Test   Loss: 0.93347\n","Test   Accuracy: 48.6%\n","Epoch 5\n","Train  Loss: 0.66369\n","Train  Accuracy: 60.1%\n","Test   Loss: 0.74259\n","Test   Accuracy: 48.6%\n","Epoch 6\n","Train  Loss: 0.66870\n","Train  Accuracy: 59.0%\n","Test   Loss: 0.74957\n","Test   Accuracy: 51.4%\n","Epoch 7\n","Train  Loss: 0.81393\n","Train  Accuracy: 51.9%\n","Test   Loss: 0.88299\n","Test   Accuracy: 52.3%\n","Epoch 8\n","Train  Loss: 0.65472\n","Train  Accuracy: 61.4%\n","Test   Loss: 0.74671\n","Test   Accuracy: 50.5%\n","Epoch 9\n","Train  Loss: 0.62888\n","Train  Accuracy: 65.3%\n","Test   Loss: 0.70563\n","Test   Accuracy: 50.5%\n","Epoch 10\n","Train  Loss: 1.26972\n","Train  Accuracy: 49.8%\n","Test   Loss: 1.29072\n","Test   Accuracy: 52.7%\n","Epoch 11\n","Train  Loss: 0.59852\n","Train  Accuracy: 67.6%\n","Test   Loss: 0.68049\n","Test   Accuracy: 59.5%\n","Epoch 12\n","Train  Loss: 0.61393\n","Train  Accuracy: 66.2%\n","Test   Loss: 0.69749\n","Test   Accuracy: 56.4%\n","Epoch 13\n","Train  Loss: 0.56148\n","Train  Accuracy: 73.1%\n","Test   Loss: 0.66336\n","Test   Accuracy: 60.5%\n","Epoch 14\n","Train  Loss: 0.54232\n","Train  Accuracy: 74.0%\n","Test   Loss: 0.63974\n","Test   Accuracy: 65.0%\n","Epoch 15\n","Train  Loss: 0.53228\n","Train  Accuracy: 73.6%\n","Test   Loss: 0.63950\n","Test   Accuracy: 66.8%\n","Epoch 16\n","Train  Loss: 0.53181\n","Train  Accuracy: 73.2%\n","Test   Loss: 0.65116\n","Test   Accuracy: 63.2%\n","Epoch 17\n","Train  Loss: 0.50478\n","Train  Accuracy: 76.2%\n","Test   Loss: 0.61242\n","Test   Accuracy: 64.5%\n","Epoch 18\n","Train  Loss: 0.50578\n","Train  Accuracy: 75.8%\n","Test   Loss: 0.61633\n","Test   Accuracy: 68.2%\n","Epoch 19\n","Train  Loss: 1.45382\n","Train  Accuracy: 55.0%\n","Test   Loss: 1.61226\n","Test   Accuracy: 49.5%\n","Epoch 20\n","Train  Loss: 0.80001\n","Train  Accuracy: 61.9%\n","Test   Loss: 0.91819\n","Test   Accuracy: 59.5%\n","Epoch 21\n","Train  Loss: 0.46076\n","Train  Accuracy: 79.2%\n","Test   Loss: 0.60600\n","Test   Accuracy: 66.8%\n","Epoch 22\n","Train  Loss: 0.51943\n","Train  Accuracy: 73.6%\n","Test   Loss: 0.63084\n","Test   Accuracy: 66.8%\n","Epoch 23\n","Train  Loss: 0.48009\n","Train  Accuracy: 77.2%\n","Test   Loss: 0.62535\n","Test   Accuracy: 64.5%\n","Epoch 24\n","Train  Loss: 0.50795\n","Train  Accuracy: 73.7%\n","Test   Loss: 0.63156\n","Test   Accuracy: 66.4%\n","Epoch 25\n","Train  Loss: 0.43859\n","Train  Accuracy: 81.1%\n","Test   Loss: 0.59569\n","Test   Accuracy: 65.9%\n","Epoch 26\n","Train  Loss: 0.48645\n","Train  Accuracy: 74.5%\n","Test   Loss: 0.66302\n","Test   Accuracy: 63.6%\n","Epoch 27\n","Train  Loss: 0.89021\n","Train  Accuracy: 64.2%\n","Test   Loss: 1.04394\n","Test   Accuracy: 58.2%\n","Epoch 28\n","Train  Loss: 0.43987\n","Train  Accuracy: 79.7%\n","Test   Loss: 0.60945\n","Test   Accuracy: 67.7%\n","Epoch 29\n","Train  Loss: 0.42390\n","Train  Accuracy: 81.4%\n","Test   Loss: 0.56863\n","Test   Accuracy: 70.0%\n","Epoch 30\n","Train  Loss: 0.43095\n","Train  Accuracy: 81.3%\n","Test   Loss: 0.56572\n","Test   Accuracy: 71.4%\n","Epoch 31\n","Train  Loss: 0.43627\n","Train  Accuracy: 79.7%\n","Test   Loss: 0.57791\n","Test   Accuracy: 69.1%\n","Epoch 32\n","Train  Loss: 0.72132\n","Train  Accuracy: 67.2%\n","Test   Loss: 0.88852\n","Test   Accuracy: 62.3%\n","Epoch 33\n","Train  Loss: 0.48455\n","Train  Accuracy: 73.1%\n","Test   Loss: 0.66840\n","Test   Accuracy: 63.2%\n","Epoch 34\n","Train  Loss: 0.40099\n","Train  Accuracy: 82.5%\n","Test   Loss: 0.57938\n","Test   Accuracy: 70.9%\n","Epoch 35\n","Train  Loss: 0.40862\n","Train  Accuracy: 83.3%\n","Test   Loss: 0.60132\n","Test   Accuracy: 67.7%\n","Epoch 36\n","Train  Loss: 0.46690\n","Train  Accuracy: 74.7%\n","Test   Loss: 0.65964\n","Test   Accuracy: 65.0%\n","Epoch 37\n","Train  Loss: 0.42875\n","Train  Accuracy: 79.0%\n","Test   Loss: 0.64646\n","Test   Accuracy: 65.0%\n","Epoch 38\n","Train  Loss: 0.39590\n","Train  Accuracy: 84.4%\n","Test   Loss: 0.55371\n","Test   Accuracy: 70.5%\n","Epoch 39\n","Train  Loss: 0.38532\n","Train  Accuracy: 84.0%\n","Test   Loss: 0.56171\n","Test   Accuracy: 70.5%\n","Epoch 40\n","Train  Loss: 0.40832\n","Train  Accuracy: 81.9%\n","Test   Loss: 0.58772\n","Test   Accuracy: 68.2%\n","Epoch 41\n","Train  Loss: 0.38561\n","Train  Accuracy: 83.9%\n","Test   Loss: 0.56543\n","Test   Accuracy: 70.9%\n","Epoch 42\n","Train  Loss: 1.59708\n","Train  Accuracy: 52.6%\n","Test   Loss: 1.81223\n","Test   Accuracy: 55.0%\n","Epoch 43\n","Train  Loss: 0.44265\n","Train  Accuracy: 78.2%\n","Test   Loss: 0.66280\n","Test   Accuracy: 67.7%\n","Epoch 44\n","Train  Loss: 0.39050\n","Train  Accuracy: 82.9%\n","Test   Loss: 0.61996\n","Test   Accuracy: 68.2%\n","Epoch 45\n","Train  Loss: 0.49807\n","Train  Accuracy: 75.5%\n","Test   Loss: 0.67359\n","Test   Accuracy: 60.9%\n","Epoch 46\n","Train  Loss: 0.39289\n","Train  Accuracy: 82.5%\n","Test   Loss: 0.61498\n","Test   Accuracy: 68.2%\n","Epoch 47\n","Train  Loss: 0.37083\n","Train  Accuracy: 84.0%\n","Test   Loss: 0.58610\n","Test   Accuracy: 70.9%\n","Epoch 48\n","Train  Loss: 0.40451\n","Train  Accuracy: 81.0%\n","Test   Loss: 0.63155\n","Test   Accuracy: 67.3%\n","Epoch 49\n","Train  Loss: 0.37058\n","Train  Accuracy: 84.5%\n","Test   Loss: 0.57647\n","Test   Accuracy: 71.8%\n","Epoch 50\n","Train  Loss: 0.46722\n","Train  Accuracy: 74.7%\n","Test   Loss: 0.67624\n","Test   Accuracy: 67.7%\n","Epoch 51\n","Train  Loss: 0.43304\n","Train  Accuracy: 80.2%\n","Test   Loss: 0.63295\n","Test   Accuracy: 68.2%\n","Epoch 52\n","Train  Loss: 0.36090\n","Train  Accuracy: 84.5%\n","Test   Loss: 0.59341\n","Test   Accuracy: 70.0%\n","Epoch 53\n","Train  Loss: 0.37661\n","Train  Accuracy: 83.7%\n","Test   Loss: 0.61363\n","Test   Accuracy: 68.6%\n","Epoch 54\n","Train  Loss: 0.40123\n","Train  Accuracy: 81.6%\n","Test   Loss: 0.65814\n","Test   Accuracy: 66.4%\n","Epoch 55\n","Train  Loss: 0.37099\n","Train  Accuracy: 85.0%\n","Test   Loss: 0.61802\n","Test   Accuracy: 67.7%\n","Epoch 56\n","Train  Loss: 0.36918\n","Train  Accuracy: 85.3%\n","Test   Loss: 0.59141\n","Test   Accuracy: 68.2%\n","Epoch 57\n","Train  Loss: 0.48028\n","Train  Accuracy: 73.3%\n","Test   Loss: 0.73681\n","Test   Accuracy: 62.3%\n","Epoch 58\n","Train  Loss: 0.36366\n","Train  Accuracy: 84.8%\n","Test   Loss: 0.63565\n","Test   Accuracy: 67.7%\n","Epoch 59\n","Train  Loss: 0.48096\n","Train  Accuracy: 72.8%\n","Test   Loss: 0.78001\n","Test   Accuracy: 64.1%\n","Epoch 60\n","Train  Loss: 0.35707\n","Train  Accuracy: 86.6%\n","Test   Loss: 0.59252\n","Test   Accuracy: 68.2%\n","Epoch 61\n","Train  Loss: 0.35424\n","Train  Accuracy: 85.7%\n","Test   Loss: 0.61309\n","Test   Accuracy: 68.2%\n","Epoch 62\n","Train  Loss: 0.61214\n","Train  Accuracy: 66.3%\n","Test   Loss: 0.91108\n","Test   Accuracy: 56.8%\n","Epoch 63\n","Train  Loss: 0.36572\n","Train  Accuracy: 85.1%\n","Test   Loss: 0.61595\n","Test   Accuracy: 70.5%\n","Epoch 64\n","Train  Loss: 0.54349\n","Train  Accuracy: 69.1%\n","Test   Loss: 0.82017\n","Test   Accuracy: 62.3%\n","Epoch 65\n","Train  Loss: 0.35303\n","Train  Accuracy: 85.6%\n","Test   Loss: 0.61878\n","Test   Accuracy: 67.3%\n","Epoch 66\n","Train  Loss: 0.53329\n","Train  Accuracy: 69.5%\n","Test   Loss: 0.84022\n","Test   Accuracy: 61.8%\n","Epoch 67\n","Train  Loss: 0.34442\n","Train  Accuracy: 86.5%\n","Test   Loss: 0.57186\n","Test   Accuracy: 69.5%\n","Epoch 68\n","Train  Loss: 0.48863\n","Train  Accuracy: 73.9%\n","Test   Loss: 0.76288\n","Test   Accuracy: 61.4%\n","Epoch 69\n","Train  Loss: 0.35488\n","Train  Accuracy: 86.0%\n","Test   Loss: 0.61383\n","Test   Accuracy: 65.9%\n","Epoch 70\n","Train  Loss: 0.36646\n","Train  Accuracy: 83.1%\n","Test   Loss: 0.61978\n","Test   Accuracy: 68.2%\n","Epoch 71\n","Train  Loss: 0.33141\n","Train  Accuracy: 86.9%\n","Test   Loss: 0.56502\n","Test   Accuracy: 71.4%\n","Epoch 72\n","Train  Loss: 0.51833\n","Train  Accuracy: 70.1%\n","Test   Loss: 0.77213\n","Test   Accuracy: 64.1%\n","Epoch 73\n","Train  Loss: 0.34390\n","Train  Accuracy: 85.2%\n","Test   Loss: 0.59118\n","Test   Accuracy: 70.9%\n","Epoch 74\n","Train  Loss: 0.32343\n","Train  Accuracy: 88.4%\n","Test   Loss: 0.55354\n","Test   Accuracy: 73.2%\n","Epoch 75\n","Train  Loss: 0.40487\n","Train  Accuracy: 81.6%\n","Test   Loss: 0.60845\n","Test   Accuracy: 66.4%\n","Epoch 76\n","Train  Loss: 0.33873\n","Train  Accuracy: 85.6%\n","Test   Loss: 0.57600\n","Test   Accuracy: 69.5%\n","Epoch 77\n","Train  Loss: 0.36643\n","Train  Accuracy: 83.8%\n","Test   Loss: 0.63570\n","Test   Accuracy: 69.1%\n","Epoch 78\n","Train  Loss: 0.32355\n","Train  Accuracy: 87.8%\n","Test   Loss: 0.56607\n","Test   Accuracy: 73.2%\n","Epoch 79\n","Train  Loss: 0.34989\n","Train  Accuracy: 84.7%\n","Test   Loss: 0.63981\n","Test   Accuracy: 70.0%\n","Epoch 80\n","Train  Loss: 0.34985\n","Train  Accuracy: 85.4%\n","Test   Loss: 0.58323\n","Test   Accuracy: 69.1%\n","Epoch 81\n","Train  Loss: 0.33062\n","Train  Accuracy: 87.3%\n","Test   Loss: 0.56037\n","Test   Accuracy: 72.3%\n","Epoch 82\n","Train  Loss: 0.32431\n","Train  Accuracy: 88.5%\n","Test   Loss: 0.56923\n","Test   Accuracy: 71.8%\n","Epoch 83\n","Train  Loss: 0.65956\n","Train  Accuracy: 65.6%\n","Test   Loss: 0.99364\n","Test   Accuracy: 59.5%\n","Epoch 84\n","Train  Loss: 0.32173\n","Train  Accuracy: 86.9%\n","Test   Loss: 0.56687\n","Test   Accuracy: 70.9%\n","Epoch 85\n","Train  Loss: 0.31747\n","Train  Accuracy: 88.5%\n","Test   Loss: 0.56477\n","Test   Accuracy: 70.9%\n","Epoch 86\n","Train  Loss: 0.33525\n","Train  Accuracy: 86.7%\n","Test   Loss: 0.58425\n","Test   Accuracy: 70.5%\n","Epoch 87\n","Train  Loss: 0.39957\n","Train  Accuracy: 80.8%\n","Test   Loss: 0.67696\n","Test   Accuracy: 65.9%\n","Epoch 88\n","Train  Loss: 0.44376\n","Train  Accuracy: 77.3%\n","Test   Loss: 0.67203\n","Test   Accuracy: 67.3%\n","Epoch 89\n","Train  Loss: 0.42289\n","Train  Accuracy: 78.7%\n","Test   Loss: 0.68240\n","Test   Accuracy: 66.4%\n","Epoch 90\n","Train  Loss: 0.35244\n","Train  Accuracy: 86.2%\n","Test   Loss: 0.57980\n","Test   Accuracy: 67.7%\n","Epoch 91\n","Train  Loss: 0.55719\n","Train  Accuracy: 69.4%\n","Test   Loss: 0.86607\n","Test   Accuracy: 61.4%\n","Epoch 92\n","Train  Loss: 0.33119\n","Train  Accuracy: 87.4%\n","Test   Loss: 0.58802\n","Test   Accuracy: 68.6%\n","Epoch 93\n","Train  Loss: 0.33425\n","Train  Accuracy: 85.1%\n","Test   Loss: 0.63578\n","Test   Accuracy: 69.5%\n","Epoch 94\n","Train  Loss: 0.53202\n","Train  Accuracy: 71.0%\n","Test   Loss: 0.84282\n","Test   Accuracy: 62.3%\n","Epoch 95\n","Train  Loss: 0.32066\n","Train  Accuracy: 87.3%\n","Test   Loss: 0.60608\n","Test   Accuracy: 68.6%\n","Epoch 96\n","Train  Loss: 0.43811\n","Train  Accuracy: 76.3%\n","Test   Loss: 0.74510\n","Test   Accuracy: 62.7%\n","Epoch 97\n","Train  Loss: 0.30844\n","Train  Accuracy: 88.4%\n","Test   Loss: 0.60910\n","Test   Accuracy: 67.3%\n","Epoch 98\n","Train  Loss: 0.53755\n","Train  Accuracy: 70.6%\n","Test   Loss: 0.84272\n","Test   Accuracy: 62.3%\n","Epoch 99\n","Train  Loss: 0.42266\n","Train  Accuracy: 78.8%\n","Test   Loss: 0.74848\n","Test   Accuracy: 63.6%\n"],"name":"stdout"},{"output_type":"execute_result","data":{"text/plain":["ShallowFBCSPNet_GeneralTrainer(filter_time_length=75, n_filters_spat=5,\n","                n_filters_time=10, nb_epoch=100, pool_time_length=60,\n","                pool_time_stride=30)"]},"metadata":{"tags":[]},"execution_count":53}]},{"metadata":{"id":"r3IytIWRdSvD","colab_type":"code","outputId":"aa40f8da-63a1-4909-ce4e-eea8fc362a3f","executionInfo":{"status":"ok","timestamp":1547778973065,"user_tz":300,"elapsed":378473,"user":{"displayName":"TheAtom2626","photoUrl":"","userId":"00378881698832173059"}},"colab":{"base_uri":"https://localhost:8080/","height":4301}},"cell_type":"code","source":["from torch import optim\n","from torch import nn\n","from braindecode.datautil.signal_target import SignalAndTarget\n","\n","# define a number of train/test trials\n","classifier.model.conv_classifier = nn.Conv2d(5, 2,(116, 1), bias=True).cuda()\n","\n","# define a number of train/test trials\n","nb_train_trials = int(np.floor(6/8*X2.shape[0]))\n","\n","# split the dataset\n","train_set = SignalAndTarget(X2[:nb_train_trials], y=y2[:nb_train_trials])\n","test_set = SignalAndTarget(X2[nb_train_trials:], y=y2[nb_train_trials:])\n","\n","train_set.X = np.concatenate((train_set.X, X3),axis=0)\n","train_set.y = np.concatenate((train_set.y, y3),axis=0)\n","\n","print(train_set.X.shape)\n","print(train_set.y.shape)\n","\n","#lr = 0.0001\n","classifier.optimizer = optim.Adam(classifier.model.parameters())\n","\n","nbIter = 50\n","\n","# array that tracks results\n","classifier.loss_rec = np.zeros((nbIter,2))\n","classifier.accuracy_rec = np.zeros((nbIter,2))\n","\n","# run all epoch\n","for i_epoch in range(nbIter):\n","\n","    classifier._batchTrain(i_epoch, train_set)\n","    classifier._evalTraining(i_epoch, train_set, test_set)"],"execution_count":54,"outputs":[{"output_type":"stream","text":["(280, 15, 3584)\n","(280,)\n","Epoch 0\n","Train  Loss: 0.65989\n","Train  Accuracy: 59.3%\n","Test   Loss: 0.68865\n","Test   Accuracy: 60.0%\n","Epoch 1\n","Train  Loss: 0.55906\n","Train  Accuracy: 72.5%\n","Test   Loss: 0.60002\n","Test   Accuracy: 62.5%\n","Epoch 2\n","Train  Loss: 0.47912\n","Train  Accuracy: 83.9%\n","Test   Loss: 0.53623\n","Test   Accuracy: 77.5%\n","Epoch 3\n","Train  Loss: 0.42306\n","Train  Accuracy: 88.2%\n","Test   Loss: 0.50652\n","Test   Accuracy: 82.5%\n","Epoch 4\n","Train  Loss: 0.37944\n","Train  Accuracy: 91.4%\n","Test   Loss: 0.48026\n","Test   Accuracy: 80.0%\n","Epoch 5\n","Train  Loss: 0.34652\n","Train  Accuracy: 92.9%\n","Test   Loss: 0.46297\n","Test   Accuracy: 80.0%\n","Epoch 6\n","Train  Loss: 0.31504\n","Train  Accuracy: 95.0%\n","Test   Loss: 0.44219\n","Test   Accuracy: 80.0%\n","Epoch 7\n","Train  Loss: 0.28979\n","Train  Accuracy: 95.0%\n","Test   Loss: 0.42785\n","Test   Accuracy: 80.0%\n","Epoch 8\n","Train  Loss: 0.26896\n","Train  Accuracy: 95.0%\n","Test   Loss: 0.41235\n","Test   Accuracy: 80.0%\n","Epoch 9\n","Train  Loss: 0.24925\n","Train  Accuracy: 96.8%\n","Test   Loss: 0.40125\n","Test   Accuracy: 82.5%\n","Epoch 10\n","Train  Loss: 0.23539\n","Train  Accuracy: 95.7%\n","Test   Loss: 0.38475\n","Test   Accuracy: 80.0%\n","Epoch 11\n","Train  Loss: 0.22239\n","Train  Accuracy: 96.1%\n","Test   Loss: 0.37808\n","Test   Accuracy: 82.5%\n","Epoch 12\n","Train  Loss: 0.20703\n","Train  Accuracy: 96.8%\n","Test   Loss: 0.36108\n","Test   Accuracy: 82.5%\n","Epoch 13\n","Train  Loss: 0.19493\n","Train  Accuracy: 96.4%\n","Test   Loss: 0.35300\n","Test   Accuracy: 80.0%\n","Epoch 14\n","Train  Loss: 0.18200\n","Train  Accuracy: 97.5%\n","Test   Loss: 0.35339\n","Test   Accuracy: 82.5%\n","Epoch 15\n","Train  Loss: 0.17329\n","Train  Accuracy: 97.5%\n","Test   Loss: 0.34628\n","Test   Accuracy: 82.5%\n","Epoch 16\n","Train  Loss: 0.16215\n","Train  Accuracy: 97.9%\n","Test   Loss: 0.32669\n","Test   Accuracy: 85.0%\n","Epoch 17\n","Train  Loss: 0.15629\n","Train  Accuracy: 98.2%\n","Test   Loss: 0.30311\n","Test   Accuracy: 87.5%\n","Epoch 18\n","Train  Loss: 0.14484\n","Train  Accuracy: 98.2%\n","Test   Loss: 0.28155\n","Test   Accuracy: 87.5%\n","Epoch 19\n","Train  Loss: 0.13607\n","Train  Accuracy: 97.9%\n","Test   Loss: 0.27485\n","Test   Accuracy: 85.0%\n","Epoch 20\n","Train  Loss: 0.13012\n","Train  Accuracy: 98.6%\n","Test   Loss: 0.25692\n","Test   Accuracy: 90.0%\n","Epoch 21\n","Train  Loss: 0.12134\n","Train  Accuracy: 98.9%\n","Test   Loss: 0.23130\n","Test   Accuracy: 92.5%\n","Epoch 22\n","Train  Loss: 0.12083\n","Train  Accuracy: 98.6%\n","Test   Loss: 0.23575\n","Test   Accuracy: 90.0%\n","Epoch 23\n","Train  Loss: 0.11108\n","Train  Accuracy: 98.9%\n","Test   Loss: 0.22305\n","Test   Accuracy: 92.5%\n","Epoch 24\n","Train  Loss: 0.10772\n","Train  Accuracy: 98.9%\n","Test   Loss: 0.20834\n","Test   Accuracy: 92.5%\n","Epoch 25\n","Train  Loss: 0.10304\n","Train  Accuracy: 98.6%\n","Test   Loss: 0.20992\n","Test   Accuracy: 90.0%\n","Epoch 26\n","Train  Loss: 0.09967\n","Train  Accuracy: 98.6%\n","Test   Loss: 0.22144\n","Test   Accuracy: 90.0%\n","Epoch 27\n","Train  Loss: 0.09205\n","Train  Accuracy: 98.9%\n","Test   Loss: 0.19879\n","Test   Accuracy: 92.5%\n","Epoch 28\n","Train  Loss: 0.08765\n","Train  Accuracy: 98.9%\n","Test   Loss: 0.19778\n","Test   Accuracy: 92.5%\n","Epoch 29\n","Train  Loss: 0.08377\n","Train  Accuracy: 99.6%\n","Test   Loss: 0.17371\n","Test   Accuracy: 97.5%\n","Epoch 30\n","Train  Loss: 0.08155\n","Train  Accuracy: 99.6%\n","Test   Loss: 0.16856\n","Test   Accuracy: 97.5%\n","Epoch 31\n","Train  Loss: 0.08312\n","Train  Accuracy: 99.3%\n","Test   Loss: 0.17106\n","Test   Accuracy: 95.0%\n","Epoch 32\n","Train  Loss: 0.07361\n","Train  Accuracy: 99.6%\n","Test   Loss: 0.14746\n","Test   Accuracy: 97.5%\n","Epoch 33\n","Train  Loss: 0.07287\n","Train  Accuracy: 99.6%\n","Test   Loss: 0.15793\n","Test   Accuracy: 97.5%\n","Epoch 34\n","Train  Loss: 0.06780\n","Train  Accuracy: 100.0%\n","Test   Loss: 0.13797\n","Test   Accuracy: 100.0%\n","Epoch 35\n","Train  Loss: 0.06772\n","Train  Accuracy: 100.0%\n","Test   Loss: 0.12142\n","Test   Accuracy: 100.0%\n","Epoch 36\n","Train  Loss: 0.06409\n","Train  Accuracy: 100.0%\n","Test   Loss: 0.11718\n","Test   Accuracy: 100.0%\n","Epoch 37\n","Train  Loss: 0.05976\n","Train  Accuracy: 100.0%\n","Test   Loss: 0.11930\n","Test   Accuracy: 100.0%\n","Epoch 38\n","Train  Loss: 0.05709\n","Train  Accuracy: 100.0%\n","Test   Loss: 0.11400\n","Test   Accuracy: 100.0%\n","Epoch 39\n","Train  Loss: 0.05475\n","Train  Accuracy: 100.0%\n","Test   Loss: 0.11658\n","Test   Accuracy: 100.0%\n","Epoch 40\n","Train  Loss: 0.05366\n","Train  Accuracy: 100.0%\n","Test   Loss: 0.11117\n","Test   Accuracy: 100.0%\n","Epoch 41\n","Train  Loss: 0.05080\n","Train  Accuracy: 100.0%\n","Test   Loss: 0.10344\n","Test   Accuracy: 100.0%\n","Epoch 42\n","Train  Loss: 0.04904\n","Train  Accuracy: 100.0%\n","Test   Loss: 0.10503\n","Test   Accuracy: 100.0%\n","Epoch 43\n","Train  Loss: 0.04694\n","Train  Accuracy: 100.0%\n","Test   Loss: 0.10309\n","Test   Accuracy: 100.0%\n","Epoch 44\n","Train  Loss: 0.04795\n","Train  Accuracy: 100.0%\n","Test   Loss: 0.09280\n","Test   Accuracy: 100.0%\n","Epoch 45\n","Train  Loss: 0.04508\n","Train  Accuracy: 100.0%\n","Test   Loss: 0.09541\n","Test   Accuracy: 100.0%\n","Epoch 46\n","Train  Loss: 0.04374\n","Train  Accuracy: 100.0%\n","Test   Loss: 0.08654\n","Test   Accuracy: 100.0%\n","Epoch 47\n","Train  Loss: 0.04240\n","Train  Accuracy: 100.0%\n","Test   Loss: 0.08018\n","Test   Accuracy: 100.0%\n","Epoch 48\n","Train  Loss: 0.03907\n","Train  Accuracy: 100.0%\n","Test   Loss: 0.08007\n","Test   Accuracy: 100.0%\n","Epoch 49\n","Train  Loss: 0.03925\n","Train  Accuracy: 100.0%\n","Test   Loss: 0.08741\n","Test   Accuracy: 100.0%\n"],"name":"stdout"}]},{"metadata":{"id":"aTd5-cW8loCN","colab_type":"code","colab":{}},"cell_type":"code","source":[""],"execution_count":0,"outputs":[]}]}